package com.shanzmoo.db.module.psys.domain.dto;

import com.alibaba.fastjson.JSON;
import com.shanzmoo.db.module.psys.entity.PSysMenuEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;

/**
 * 平台管理系统菜单 保存对象
 *
 * @author Gzhao 2021-03-10
 */
@Data
@ApiModel("平台管理系统菜单-保存对象")
public class MenuSaveDTO implements Serializable {

    private static final long serialVersionUID = 1L;


    @ApiModelProperty(value = "父级菜单")
    private Integer parentId;

    @ApiModelProperty(value = "菜单名称")
    private String menuName;

    @ApiModelProperty(value = "是否隐藏菜单：0-显示，1-隐藏")
    private Boolean hidden;

    @ApiModelProperty(value = "前端路由地址")
    private String routerUrl;

    @ApiModelProperty(value = "前端组件路径")
    private String componentPath;

    @ApiModelProperty(value = "权限标识")
    private String perms;

    @ApiModelProperty(value = "排序号")
    private Integer menuIndex;

    private String routerName;
    private String redirectUrl;
    private Boolean status;
    private String param;

    public static PSysMenuEntity converted(MenuSaveDTO saveDto) {
        return JSON.parseObject(JSON.toJSONString(saveDto), PSysMenuEntity.class);
    }
}
